<?php
/**
 * Created by PhpStorm.
 * User: serenehaly
 * Date: 2018/1/22
 * Time: 10:16
 */

namespace app\api\controller\v1;


use app\api\model\Banner as BannerModel;
use app\api\validate\PositiveInteger;
use app\lib\exception\BannerMissException;

class Banner
{
    /**
     * @param $id
     */
    public function getBanner($id)
    {
        $validate = new PositiveInteger();
        $validate->goCheck();
        $banner = BannerModel::getBannerById($id);
        if (!$banner) {
            throw new BannerMissException();
        } else {
            return $banner;
        }
    }
}